<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>
<%@ include file="/common/grid/jqGrid.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="">
	<meta http-equiv="description" content="This is my page">
	
  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    		<table width="600px">
    			<tr>
    				<td align="left">
			    		<input type="button" class="btn" value="click" onclick="clickThis()" />
			    		<input type="button" class="btn" value="show" onclick="showCb()" />
			    		<input type="button" class="btn" value="params" onclick="showParam()" />
			    		<div id="cbDiv" style="width:200px"></div>
			    		<div id="cbDiv2"></div>
			    		<div id="cbDiv3"></div>
			    		<div id="cbDiv4"></div>
			    		<div id="cbDiv5"></div>
    				</td>
    			</tr>
    			<tr>
    				<td align="left">
			    		<s:property value="message" escape="false"/>
    				</td>
    			</tr>
    		</table>
    	</s:form>
    </center>
    
    <script type="text/javascript">
    $(function(){
        showLoading();
		/*$('#cbDiv').mycomponent({
			type:'select',
			name:'mycom',
			fetchType:'local',
			data:'[{"value":"1","label":"横向"},{"value":"2","label":"纵向"}]',
			listKey:'value',
			listValue:'label',
			headerKey:'',
			headerValue:'--请选择--',
			width:'100%'
		});
		
		$('#cbDiv2').mycomponent({
			type:'checkbox',
			name:'mycom2',
			fetchType:'remote',
			url:'ajax/testData.action',
			data:'department',
			direction:'vertical',
			listKey:'id',
			listValue:'deptName',
			headerKey:'',
			headerValue:'--请选择--',
			params:null
		});
		
		$('#cbDiv3').mycomponent({
			type:'radio',
			name:'mycom3',
			fetchType:'remote',
			url:'ajax/testData.action',
			data:'department',
			listKey:'id',
			listValue:'deptName',
			params:{'name':'hello'}
		});*/
		
		$('#cbDiv4').mycomponent({
			type:'select',
			name:'mycom4',
			fetchType:'remote',
			url:'ajax/testData.action',
			data:'user',
			params:null,
			listKey:'id',
			listValue:'username',
			headerKey:'',
			headerValue:'--请选择--',
			width:'120'
		});

		/*$('#cbDiv5').mycomponent({
			type:'radio',
			name:'mycom5',
			fetchType:'remote',
			url:'ajax/testData.action',
			data:'department',
			direction:'vertical',
			listKey:'id',
			listValue:'deptName',
			headerKey:'',
			headerValue:'--请选择--',
			params:null
		});*/
		hideLoading();
    });
    
    function clickThis()
    {
    	$.ajax({
			url:realPath + '/ajax/testAjax.action',
			type:'get',
			data:{name:'good'},
			dataType:'json',
			async: false,
			success:function(result){
				alert(result);
			}
		});
    }

    function showCb()
    {
        var checkcb = $('input:cbeckbox[name="mycb"][checked]');
        var len = checkcb.length;
        var result = '';
        for(var i = 0; i < len; i++)
        {
            var cbx = $(checkcb.get(i));
            result += cbx.val() + ',';
        }
        alert(result);
    }

    function showParam()
    {
        ajaxAction('ajax/testParam.action', 'post', 'frm', false, function(){
			
        });
    }
    </script>
  </body>
</html>
